package com.kaisa.activity.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.kaisa.activity.R;
import com.kaisa.activity.bean.MoreTheme;

import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

import java.util.List;

/**
 * Created by 123 on 2015/12/17.
 */
public class MoreThemeAdapter extends AppBaseAdapter<MoreTheme.MarketActivitysEntity> {

    public MoreThemeAdapter(List<MoreTheme.MarketActivitysEntity> list, Context context) {
        super(list, context);
        inflater = LayoutInflater.from(context);
    }

    @Override
    public View getItemView(int position, View convertView, ViewGroup parent) {
        ThemeViewHolder holder = null;
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.item_more_theme, null);
            holder = new ThemeViewHolder(convertView);
        } else {
            holder = (ThemeViewHolder) convertView.getTag();
        }
        holder.textView.setText(list.get(position).getHeading());
        x.image().bind(holder.imageView,list.get(position).getPic());
        return convertView;
    }

    public static class ThemeViewHolder extends BaseViewHolder {
        @ViewInject(R.id.img_theme2)
        private ImageView imageView;
        @ViewInject(R.id.tv_theme2)
        private TextView textView;

        public ThemeViewHolder(View convertView) {
            super(convertView);
            x.view().inject(this, convertView);
        }
    }
}
